<template>
  <div>
    <!-- <div>{{ $route.params.id }}</div> -->
    <div v-for="item in list" :key="item.id">
      <h3>{{ item.subject_title }}</h3>
      <img class="imgbox" :src="imgBase + item.cover_url" alt="" />
    </div>
  </div>
</template>

<script>
export default {
  name: "TvDetail",
  create() {
  },
  data() {
    return {
      baseUrl: "https://bird.ioliu.cn/v2?url=",
      imgBase: "https://images.weserv.nl/?url=",
      TvDetailList: {},
      list:[{}],
      TvId: "",
    };
  },
  mounted() {
    this.TvId = this.$route.params.id;
    console.log(this.TvId);
    this.getData();
  },
  methods: {
    getData() {
      // const Tv_url = `https://m.douban.com/rexxar/api/v2/tv/${this.TvId}?ck=&for_mobile=1`;
      this.axios.get(this.baseUrl + `https://m.douban.com/rexxar/api/v2/tv/${this.TvId}?ck=&for_mobile=1`).then((res) => {
        this.TvDetailList = res.data.trailer
        // 返回的数据是对象，使用对象转数组方法
        for(const i in this.TvDetailList){
          this.$set(this.list[0],i,this.TvDetailList[i])
        }
        console.log(this.list);
      });
    },
  },
};
</script>

<style>
.imgbox{
  width: 100%;
}
</style>